import java.util.Scanner;

// MP3光标位置
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt(); // 10
        int start = 1, end = Math.min(n, 4);
        int result = 1;
        while (scanner.hasNext()) {
            String str = scanner.next();
            for(int i = 0; i < str.length() && str.length() > 1; ++i) {
                char ch = str.charAt(i);
                if(ch == 'U') {
                    if(result == 1) {
                        end = n;
                        start = n - 3;
                        result = end;
                    } else {
                        result--;
                        if(result < start) {
                            start--;
                            end--;
                        }
                    }
                } else if(ch == 'D') {
                    if(result == n) {
                        start = 1;
                        end = 4;
                        result = 1;
                    } else {
                        result++;
                        if(result > end) {
                            end++;
                            start++;
                        }
                    }
                }
            }

        }
        for (int i = start; i <= end; i++) {
            if(i > 0)
                System.out.print(i + " ");
        }
        System.out.println();
        System.out.println(result);
    }
}